# @ModuleName: login_page
# @Author: zxl
# @Time: 2024/6/15 10:46'
from quote.base.browseoperation import BrowserOperation
from quote.base.usebrowserteacher import UseBrowser
from quote.base.userbrowser import UserBrowser


class LoginPage:
    def __init__(self):
        self.ub = UserBrowser()
        self.bo = BrowserOperation(UserBrowser.driver)
    # 登录
    def login(self,username = '',password = ''):
        self.bo.open_url('http://172.16.114.98:8080/JavaPrj_6/')
        self.bo.input_text('name', 'username', username)
        self.bo.input_text('name', 'password', password)
        self.bo.click_element('name', 'submit')
        # self.ub.quit()

    # 获取登陆成功的提示信息
    def get_suc_info(self):
        self.bo.change_frame('main')
        return self.bo.get_text('xpath','/html/body/table/tbody/tr[1]/td/span')


    def get_fail_info(self):
        return self.bo.get_text('xpath','/html/body/table/tbody/tr[1]/td[2]/form/table/tbody/tr[5]/td')
